package com.blocks.gui;

import java.util.Map;

import com.blocks.ScriptBlocksApplication;
import com.blocks.blocks.Block;
import com.blocks.controller.BlockUtils;

import de.lessvoid.nifty.Nifty;
import de.lessvoid.nifty.NiftyEventSubscriber;
import de.lessvoid.nifty.controls.Label;
import de.lessvoid.nifty.controls.ListBox;
import de.lessvoid.nifty.controls.ListBoxSelectionChangedEvent;
import de.lessvoid.nifty.screen.Screen;
import de.lessvoid.nifty.screen.ScreenController;

public class HelpScreenController implements ScreenController {
	private Nifty nifty;
	private Screen screen;
	private ListBox listBox1;
	private Label label;

	@Override
	public void bind(Nifty nifty, Screen screen) {
		this.nifty = nifty;
		this.screen = screen;
		this.listBox1 = screen.findNiftyControl("listBox1", ListBox.class);
		this.label = screen.findNiftyControl("label1", Label.class);

		if (listBox1 != null) {
			listBox1.addItem("Menu (Esc) : Start | Export | Exit");
			listBox1.addItem("Block Select (Space) : Opens a screen to select a block");
			listBox1.addItem("Add Master Block (R)");
			listBox1.addItem("Toggle Block (E) : If block is toggleable ");
			listBox1.addItem("Add Block (Mouse Right Click) : When Master Block is not powered");
			listBox1.addItem("Remove Block (X) : When Master Block is not powered");
			listBox1.addItem("Move Focused Master (UP,DOWN,LEFT,RIGHT, PGUP, PGDN)");
			listBox1.addItem("Move Camera (Mouse Movement)");
			listBox1.addItem("Copy Focus Block and all its children (C) : When Master Block is not powered");
			listBox1.addItem("Paste Block and all its children (V) : When Master Block is not powered");
			listBox1.addItem("Help (H)");
		}
		this.label.setText(ScriptBlocksApplication.getInstance().getLevelProperties().getLevelDescription());

	}

	@Override
	public void onEndScreen() {
		// TODO Auto-generated method stub

	}

	@Override
	public void onStartScreen() {
		// TODO Auto-generated method stub

	}



	public void backToGame() {		
		ScriptBlocksApplication.getInstance().gameState();
		ScriptBlocksApplication.getInstance().setNiftyActive(false);
		nifty.exit();
	}

}
